<template>
    <div class="wrap">
        <div class="container">
            <TopBreadCrumb></TopBreadCrumb>
            <div class="user_center_content">
                <!-- 左侧菜单 -->
                <LeftNavMenu></LeftNavMenu>
                <!-- 左侧菜单结束 -->
                <!-- 右侧内容开始  -->
                <div class="right_user_content">
                    <div class="right-title border-bottom">
                        <div class="left">我的钱包</div>
                    </div>
                    <div class="enterprise-list myWallet" v-loading="loading">
                        <!-- 钱包列表 -->
                        <div class="enterprise-card" v-for="(item,index) in data.data" :key="index">
                            <div class="title">{{item.name}}</div> 
                            <div class="amount">
                                <div class="item">
                                    <span>{{item.blance}}</span>
                                    账户余额
                                </div>
                                <div class="item">
                                    <span>{{item.total_amount}}</span>
                                    累计消费
                                </div>
                            </div>
                        </div>

                    </div>
                    <CustomPagination :total="data.total" :page.sync="query.page" :pageSize.sync="query.pageSize" @pagination="LoadWalletList" :hidden="pageHidden"></CustomPagination>
                </div>
                <!-- 右侧内容结束 -->
            </div>
        </div>

    </div>
</template>

<script>
import api from "@/api/user"
export default {
    data() {
        return {
            walletList: [
                {
                    title: "北京鑫康辰医学科技发展有限公司",
                    balance: "13209.00",
                    consumption: "102108.00",
                },
                {
                    title: "广东基顺隆医用复合膜有限公司",
                    balance: "13209.00",
                    consumption: "102108.00",
                },
                {
                    title: "北京博雅晟康医学科技有限公司",
                    balance: "13209.00",
                    consumption: "102108.00",
                },
                {
                    title: "广东基顺隆医用复合膜有限公司",
                    balance: "13209.00",
                    consumption: "102108.00",
                },
                {
                    title: "广东基顺隆医用复合膜有限公司",
                    balance: "13209.00",
                    consumption: "102108.00",
                },
                {
                    title: "广东基顺隆医用复合膜有限公司",
                    balance: "13209.00",
                    consumption: "102108.00",
                }

            ],
            query: {
                page: 1,
                pageSize: 6
            },
            data: {
                total: 0,
                data: []
            },
            pageHidden: true,
            loading: false
        };
    },
    methods: {
        LoadWalletList: function () {
            var _this = this;
            _this.loading = true;
            api.GetWalletPageList(_this.query)
                .then((res) => {
                    _this.loading = false;
                    _this.data = res.data;
                    _this.pageHidden = false;
                    if (_this.query.pageSize >= _this.data.total) {
                        _this.pageHidden = true;
                    }
                }).catch((err) => {
                    _this.loading = false;
                })
        }
    },
    mounted: function(){
        this.LoadWalletList();
    }

  };
</script>